Improve the tracking rect updating: - No need to override setFrame. - Use
authorRichard Hult <richard@imendio.com>
Sat, 30 Jun 2007 08:56:50 +0000 (08:56 +0000)
committerRichard Hult <rhult@src.gnome.org>
Sat, 30 Jun 2007 08:56:50 +0000 (08:56 +0000)
2007-06-30  Richard Hult  <richard@imendio.com>

* gdk/quartz/GdkQuartzView.c: Improve the tracking rect updating:
- No need to override setFrame.
- Use our own size instead of the bounds from for the view as it's
not always updated before the tracking rect.
- Only reset the tracking rect if the new window is nil).

* gdk/quartz/GdkQuartzWindow.c: Update the bounds of the content
view when the window size changes.

svn path=/trunk/; revision=18309

ChangeLog
gdk/quartz/GdkQuartzView.c
gdk/quartz/GdkQuartzWindow.c

index 33c4f100b7b608cbfbde51b187dc37f64db0f654..2ca0272f8b3a859176f983c4d53fd3f41eb9404c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-06-30  Richard Hult  <richard@imendio.com>
+
+       * gdk/quartz/GdkQuartzView.c: Improve the tracking rect updating:
+       - No need to override setFrame.
+       - Use our own size instead of the bounds from for the view as it's
+       not always updated before the tracking rect.
+       - Only reset the tracking rect if the new window is nil).
+       
+       * gdk/quartz/GdkQuartzWindow.c: Update the bounds of the content
+       view when the window size changes.
+
 2007-06-30  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkbuilderparser.c (_gtk_builder_parse_boolean): 
index fbeaf136f3fb3fb573c574dd44039682d5e58e1e..cb92928e7bac0705d431e0eb6838393ecc3ab143 100644 (file)
@@ -1,6 +1,6 @@
 /* GdkQuartzView.m
  *
- * Copyright (C) 2005 Imendio AB
+ * Copyright (C) 2005-2007 Imendio AB
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 {
   GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
   GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+  NSRect rect;
 
   if (trackingRect)
     {
   if (!impl->toplevel)
     return;
 
-  trackingRect = [self addTrackingRect:[self bounds]
+  /* Note, if we want to set assumeInside we can use:
+   * NSPointInRect ([[self window] convertScreenToBase:[NSEvent mouseLocation]], rect)
+   */
+
+  rect = NSMakeRect (0, 0, impl->width, impl->height);
+  trackingRect = [self addTrackingRect:rect
                                  owner:self
                               userData:nil
                           assumeInside:NO];
 
 -(void)viewWillMoveToWindow:(NSWindow *)newWindow
 {
-  if ([self window] && trackingRect)
+  if (newWindow == nil && trackingRect)
     {
       [self removeTrackingRect:trackingRect];
       trackingRect = nil;
     }
 }
 
--(void)setFrame:(NSRect)frame
-{
-  [super setFrame:frame];
-  [self updateTrackingRect];
-}
 -(void)setBounds:(NSRect)bounds
 {
   [super setBounds:bounds];
index 97c01e79e8cb78e9f8499c001bec1fb5d5676f03..d86c21ddd290243089d7fa516bc45676721edb3f 100644 (file)
   impl->width = content_rect.size.width;
   impl->height = content_rect.size.height;
 
+  [[self contentView] setBounds:NSMakeRect (0, 0, impl->width, impl->height)];
+
   /* Synthesize a configure event */
   event = gdk_event_new (GDK_CONFIGURE);
   event->configure.window = g_object_ref (window);